package com.hpin.mlxteacher.tree;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.hpin.mlxteacher.R;
import com.hpin.mlxteacher.adapter.ClassifyAdapter;
import com.hpin.mlxteacher.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * 选择标题
 * Created by Aaron on 15/7/30.
 */
public class ChooseTitleActivity extends BaseActivity {

    private List<String> leftLists;
    private List<String> rightLists;
    private List<String> rightoLists;
    private List<String> righttLists;
    private ClassifyAdapter rightAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_choose_title);

        initWidget();

    }

    private void initWidget() {

        ImageView tv_left = (ImageView) findViewById(R.id.iv_left);
        TextView tv_title = (TextView) findViewById(R.id.tv_title);

        tv_title.setText(getResources().getString(R.string.choose_style));

        tv_left.setOnClickListener(this);

        ListView lv_left = (ListView) findViewById(R.id.lv_left);
        ListView lv_right = (ListView) findViewById(R.id.lv_right);

        leftLists = new ArrayList<String>();
        leftLists.add("全部");
        leftLists.add("日常");
        leftLists.add("感官");
        leftLists.add("语言");
        leftLists.add("算术");
        leftLists.add("艺术");
        leftLists.add("礼仪");
        leftLists.add("活动");
        leftLists.add("餐饮");

        rightLists = new ArrayList<String>();
        rightLists.add("全部");
        rightLists.add("全部");
        rightLists.add("全部");
        rightLists.add("全部");
        rightLists.add("全部");
        rightLists.add("全部");

        rightoLists = new ArrayList<String>();
        rightoLists.add("日常");
        rightoLists.add("日常");
        rightoLists.add("日常");
        rightoLists.add("日常");
        rightoLists.add("日常");

        righttLists = new ArrayList<String>();
        righttLists.add("感官");
        righttLists.add("感官");
        righttLists.add("感官");
        righttLists.add("感官");
        righttLists.add("感官");

        ClassifyAdapter leftAdapter = new ClassifyAdapter(this, leftLists);
        lv_left.setAdapter(leftAdapter);

        rightAdapter = new ClassifyAdapter(this, rightLists);
        lv_right.setAdapter(rightAdapter);

        lv_left.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

                switch (i) {

                    case 0:

                        rightAdapter.setStrs(rightLists);

                        break;
                     case 1:
                         rightAdapter.setStrs(rightoLists);
                        break;
                     case 2:
                         rightAdapter.setStrs(righttLists);
                        break;

                }

                rightAdapter.notifyDataSetChanged();

            }
        });

    }

    @Override
    public void widgetClick(View v) {

        switch (v.getId()) {
            case R.id.iv_left:
                finish();
                break;
        }
    }
}
